/*
 * @Author: Wenjiahao
 * @Date: 2022-10-12 19:42:33
 * @LastEditors: wenjiahao
 * @LastEditTime: 2022-10-12 20:01:14
 * @FilePath: \mobile-library-server\src\models\backend-role.model.ts
 * @Description: 
 */
// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
// 后台角色表
import { Sequelize, DataTypes, Model } from 'sequelize';
import { Application } from '../declarations';
import { HookReturn } from 'sequelize/types/hooks';

export default function (app: Application): typeof Model {
  const sequelizeClient: Sequelize = app.get('sequelizeClient');
  const backendRole = sequelizeClient.define('backend_role', {
    text: {
      type: DataTypes.STRING,
      allowNull: false
    },
    
  }, {
    hooks: {
      beforeCount(options: any): HookReturn {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  (backendRole as any).associate = function (models: any): void {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return backendRole;
}
